/*
 *
 * <p>BaseAction.java</p>
 *   
 * Created on 2009-7-28 by sunan
 *
 * $Log:$
 */

package cn.hs.blog.base;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public abstract class BaseAction extends HttpServlet {

    /**
     * 
     */
    private static final long serialVersionUID = -8268597704925256190L;

    public void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws IOException {
        doBefore(req, resp);
        execute(req, resp);
        doAfter(req, resp);
    }

    public void doPost(HttpServletRequest req, HttpServletResponse resp)
        throws IOException {
        doBefore(req, resp);
        execute(req, resp);
        doAfter(req, resp);
    }
    
    public void doAfter(HttpServletRequest req, HttpServletResponse resp)
    throws IOException {
        req.setAttribute("title", "hsBlog");
    }
    
    public void doBefore(HttpServletRequest req, HttpServletResponse resp)
    throws IOException {
        
    }

    public abstract void execute(HttpServletRequest req, HttpServletResponse resp)
        throws IOException;

}
